import request from '@/utils/request'

// 查询横向课题列表
export function listHorizontalProjects(query) {
  return request({
    url: '/result/horizontalProjects/list',
    method: 'get',
    params: query
  })
}

// 查询横向课题详细
export function getHorizontalProjects(id) {
  return request({
    url: '/result/horizontalProjects/' + id,
    method: 'get'
  })
}
/**
 * 根据多个id批量查询横向课题详细
 */
export function getHorizontalProjectsByIds(ids) {
  return request({
    url: `/result/horizontalProjects/getHorizontalProjectsByIds`,
    method: 'get',
    params: { ids: ids.join(',') } // 将数组转换为逗号分隔的字符串
  });
}
// 新增横向课题
export function addHorizontalProjects(data) {
  return request({
    url: '/result/horizontalProjects',
    method: 'post',
    data: data
  })
}

// 修改横向课题
export function updateHorizontalProjects(data) {
  return request({
    url: '/result/horizontalProjects',
    method: 'put',
    data: data
  })
}

// 删除横向课题
export function delHorizontalProjects(id) {
  return request({
    url: '/result/horizontalProjects/' + id,
    method: 'delete'
  })
}
/**
 * 批量导出横向课题
 */
export function exportHorizontalProjects(params) {
  return request.post(`/result/horizontalProjects/export/horizontalProjects`, params, {
    responseType: 'blob'
  });
}
